﻿using OnHook.Framework.Pager;

namespace OnHook.Framework.Extensions
{
    public static class PageExtension
    {
        public static PagedList<T> ToPagedList<T>(this IPagedSearchDto? searchDto, List<T> dataList = null!, int count = 0)
        {
            return new PagedList<T>(searchDto?.PageIndex ?? 1, searchDto?.PageSize ?? 20)
            {
                ItemList = dataList,
                RecordCount = count
            };
        }
    }
}
